package com.shushan.home.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.android.net.bean.NetBaseBean;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @ClassName: LearnByDoBean
 * @Desciption: 边学边练bean
 * @author: yichaohua
 * @date: 2018-04-16
 */
public class LearnByDoBean extends NetBaseBean implements Parcelable {

    public int id;
    public String video_title;//标题
    public String video_desc;//描述
    public String video_url;//视频地址
    public String video_size;//视频大小
    public String cover;//封面
    public String video_teacher;//讲解老师

    private RewardTimeBean rewardTimeBean;
    private RewardToyBean rewardToyBean;

    public LearnByDoBean() {
        super();
    }

    public LearnByDoBean(int id, String video_title, String video_desc, String video_url,String video_size,String cover,String video_teacher) {
        super();
        this.id = id;
        this.video_title = video_title;
        this.video_desc = video_desc;
        this.video_url = video_url;
        this.video_size = video_size;
        this.cover = cover;
        this.video_teacher = video_teacher;
    }

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        id = jsonObject.optInt("id",-1);
        video_title = jsonObject.optString("video_title","");
        video_desc = jsonObject.optString("video_desc","");
        video_url = jsonObject.optString("video_url","");
        video_size = jsonObject.optString("video_size","");
        cover = jsonObject.optString("cover","");
        video_teacher = jsonObject.optString("video_teacher","");
    }

    public  RewardTimeBean getRewardTimeBean() {
        return rewardTimeBean;
    }

    public  void setRewardTimeBean(RewardTimeBean rewardTimeBean) {
        this.rewardTimeBean = rewardTimeBean;
    }

    public RewardToyBean getRewardToyBean() {
        return rewardToyBean;
    }

    public void setRewardToyBean(RewardToyBean rewardToyBean) {
        this.rewardToyBean = rewardToyBean;
    }

    @Override
    public String toString() {
        return super.toString();
    }

    public static final Creator<LearnByDoBean> CREATOR = new Creator<LearnByDoBean>() {

        @Override
        public LearnByDoBean createFromParcel(Parcel source) {
            LearnByDoBean learnByDoBean = new LearnByDoBean();
            learnByDoBean.id = source.readInt();
            learnByDoBean.cover = source.readString();
            learnByDoBean.video_desc = source.readString();
            learnByDoBean.video_size = source.readString();
            learnByDoBean.video_teacher = source.readString();
            learnByDoBean.video_title = source.readString();
            learnByDoBean.video_url = source.readString();
            return learnByDoBean;

        }

        @Override
        public LearnByDoBean[] newArray(int size) {
            return new LearnByDoBean[size];
        }
    };

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(cover);
        dest.writeString(video_desc);
        dest.writeString(video_size);
        dest.writeString(video_teacher);
        dest.writeString(video_title);
        dest.writeString(video_url);
    }

    @Override
    public int describeContents() {
        return 0;
    }
}
